﻿<?=$this->load->view('include_header',null)?>
	<div id="top-panel">
		<div id="panel">
			<ul>
				<li class="current"><a href="<?=site_url('archive/idcard/'.$id)?>" class="report"><?=(empty($id))?"录入新":"编辑"?>客户基本信息</a></li>
				
			</ul>
		</div>
	</div>
	<div id="wrapper">
		<div id="content">
			<div id="box">
			<form id="form" method="POST" action="<?=site_url('archive/business_update/'.$cateid)?>">
			<fieldset>
			<legend>营业执照 Business License</legend>
			
			<label>副 本<br>(DUPLICATE)No.:</label><input type="text" name="duplicate_no" size="30" value="<?=@$info->duplicate_no?>" /> <br /> <br>
			<label>注册号<br>Registration No.:</label><input type="text" name="registration_no" size="30" value="<?=@$info->registration_no?>" /> <br /><br>
			<label>名 称<br>Name of Institution:</label><input type="text" name="institution_name" size="50" value="<?=@$info->institution_name?>" /> <br /><br>	
			<label>住 所<br>Address:</label><input type="text" name="address" size="50" value="<?=@$info->address?>" /> <br /> <br>
			<label>法定代表人姓名<br>Legal Representative:</label><input type="text" name="legal_representative" value="<?=@$info->legal_representative?>" /> <br /> <br>
			<label>注册资本<br>Registered Capital:</label><input type="text" name="registered_capital" value="<?=@$info->registered_capital?>" />RMB <br /><br>
			<label>实收资本<br>Real Capital:</label><input type="text" name="real_capital" value="<?=@$info->real_capital?>" />RMB <br /> <br>
			<label>公司类型<br>Economical Type:</label><input type="text" name="economical_type" size="50" value="<?=@$info->economical_type?>" /> <br /> <br>
			
			<label>经营范围<br>Objective and Scope:</label><textarea name="scope" cols="50" rows="5"><?=@$info->scope?></textarea> <br />  <br>
			<label>营业期限从<br>Valid From:</label><input type="text" name="validity_from" id="validity_from" value="<?=@$info->validity_from?>" onchange="check_date_rules()"/> <br /> <br>
			<label>营业期限至<br>Valid To:</label><input type="text" name="validity_to" id="validity_to" value="<?=@$info->validity_to?>"  onchange="check_date_rules()"/> <br />   <br>
			<label>成立日期<br>Date of Establish</label><input type="text" name="established_date" id="established_date" value="<?=@$info->established_date?>"  onchange="check_date_rules()"/> <br /><br>
			<label>颁发机关<br>Issued by:</label><input type="text" name="issued_by" size="50" value="<?=@$info->issued_by?>" /> <br /><br>
						
			<input type="hidden" name="id" value="<?=$id?>" />
			<input id="button1" type="submit" value="提交信息 Continue" onclick="return check_date_rules()"/>
			<input id="button2" type="reset" value="重置 Cancel" />
			</fieldset>
			</form>
			</div>

		</div>
		
		<?=$this->load->view('include_sidebar',array('id'=>$id,'forms'=>$forms))?>
	</div>

	<script type="text/javascript">
    
    function check_date_rules() {
        if(convert_to_date($('#validity_from').val()).getTime() >  new Date().getTime()) {
            $('#validity_from').focus();  
            alert('[营业期限从]不能大于[当前日期]！');
            return false;
        }         
        /*if(convert_to_date($('#validity_to').val()).getTime() >  new Date().getTime()) {
            $('#validity_to').focus();   
            alert('[营业期限至]不能大于[当前日期]！');
            return false;
        }*/   
        if(convert_to_date($('#established_date').val()).getTime() > new Date().getTime()) {
            $('#established_date').focus(); 
            alert('[成立日期]不能大于[当前日期]！'); 
            return false;
        } 
        if(convert_to_date($('#validity_from').val()).getTime() > convert_to_date($('#validity_to').val()).getTime()) {
            $('#validity_from').focus(); 
            alert('[营业期限从]不能大于[营业期限至]！'); 
            return false;
        }                        
        return true; 
    }
    
	$().ready(function() {
	  $("#form").validate({
		rules: {
			duplicate_no:{
			 required:true
			},
			registration_no:{
			 required:true
			},
			institution_name:{
			 required:true
			},
			address:{
			 required:true
			},
			legal_representative:{
			 required:true
			}
		}
	  });
      
            
        $.datepicker.setDefaults(
            {
            dateFormat: 'dd/mm/yy',
            changeMonth: true,
            changeYear: true,
            showOn: "both",
            buttonImage: "images/calendar.gif",
            buttonImageOnly: true
            }
        );
        
		$( "#validity_from" ).datepicker();
		$( "#validity_to" ).datepicker();
		$( "#established_date" ).datepicker();
		
	});
	</script>
	
<?=$this->load->view('include_footer',null)?>
